package spider.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
 @Table
 @Entity
public class Result {
	 
	public Result(long id, String url, String title, String content,
			String visibleUrl, String gsearchResultClass, String unescapedUrl,
			String cacheUrl, String titleNoFormatting, KeyWords query) {
		super();
		this.id = id;
		this.url = url;
		this.title = title;
		this.content = content;
		this.visibleUrl = visibleUrl;
		this.gsearchResultClass = gsearchResultClass;
		this.unescapedUrl = unescapedUrl;
		this.cacheUrl = cacheUrl;
		this.titleNoFormatting = titleNoFormatting;
		this.query = query;
	}
	@Column
	@Id
	@GeneratedValue
	private long id;
	@Column
	private String url;
	@Column
	private String title;
	@Column
	private String content;
	@Column
	private String visibleUrl;
	@Column
	private String gsearchResultClass;
	@Column
	private String unescapedUrl;
	@Column
	private String cacheUrl;
	@Column
	private String titleNoFormatting;
	@ManyToOne (targetEntity=KeyWords.class)
	@JoinColumn(referencedColumnName="id" )
	private KeyWords query;
	 
	@Override
	public String toString() {
		return "Result [  id=" + id + ", url=" + url
				+ ", title=" + title + ", content=" + content + ", visibleUrl="
				+ visibleUrl + ", GsearchResultClass=" + gsearchResultClass
				+ ", unescapedUrl=" + unescapedUrl + ", cacheUrl=" + cacheUrl
				+ ", titleNoFormatting=" + titleNoFormatting + ", query="
				+ query + "]";
	}
	public Result(KeyWords query) {
		super();
		this.query = query;
	}
	public KeyWords getQuery() {
		return query;
	}
	public void setQuery(KeyWords query) {
		this.query = query;
	}
	 
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getVisibleUrl() {
		return visibleUrl;
	}
	public void setVisibleUrl(String visibleUrl) {
		this.visibleUrl = visibleUrl;
	}
	public String getGsearchResultClass() {
		return gsearchResultClass;
	}
	public void setGsearchResultClass(String gsearchResultClass) {
		this.gsearchResultClass = gsearchResultClass;
	}
	public String getUnescapedUrl() {
		return unescapedUrl;
	}
	public Result(long id, String url, String title, String content,
			String visibleUrl, String gsearchResultClass, String unescapedUrl,
			String cacheUrl, String titleNoFormatting) {
		super();
		this.id = id;
		this.url = url;
		this.title = title;
		this.content = content;
		this.visibleUrl = visibleUrl;
		this.gsearchResultClass = gsearchResultClass;
		this.unescapedUrl = unescapedUrl;
		this.cacheUrl = cacheUrl;
		this.titleNoFormatting = titleNoFormatting;
	}
	public Result() {
		super();
		// TODO Auto-generated constructor stub
	}
	public void setUnescapedUrl(String unescapedUrl) {
		this.unescapedUrl = unescapedUrl;
	}
	public String getCacheUrl() {
		return cacheUrl;
	}
	public void setCacheUrl(String cacheUrl) {
		this.cacheUrl = cacheUrl;
	}
	public String getTitleNoFormatting() {
		return titleNoFormatting;
	}
	public void setTitleNoFormatting(String titleNoFormatting) {
		this.titleNoFormatting = titleNoFormatting;
	}
	 
	
}
